package cn.kshost.zqyg.manager.controller;

import cn.kshost.zqyg.manager.service.OrderStatisticsService;
import cn.kshost.zqyg.model.dto.order.OrderStatisticsDto;
import cn.kshost.zqyg.model.vo.common.Result;
import cn.kshost.zqyg.model.vo.common.ResultCodeEnum;
import cn.kshost.zqyg.model.vo.order.OrderStatisticsVo;
import cn.kshsot.zqyg.common.log.Log;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag( name = "订单接口")
@RequestMapping("/admin/order/orderInfo")
public class OrderController {
    @Autowired
    private OrderStatisticsService orderStatisticsService;

    @Operation(summary = "根据时间区间获取订单数据")
    @GetMapping("/getOrderStatisticsData")
    @Log(title = "订单接口查询订单汇总",businessType=0)
    public Result<OrderStatisticsVo> getOrderStatisticsData(OrderStatisticsDto orderStatisticsDto) {
        OrderStatisticsVo orderStatisticsData = orderStatisticsService.getOrderStatisticsData(orderStatisticsDto);
        return  Result.build(orderStatisticsData, ResultCodeEnum.SUCCESS);
    }
}
